<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>xmake v2.2.7 发布, 改进Cuda项目构建</title>
    <meta name="description" content="这个版本主要对Cuda项目的构建做了很多的改进，并且新增了对lex/yacc编译支持，同时也对target新增了on_link, before_link和after_link等链接阶段的定制化支持。这里，我还要感谢下@OpportunityLiu对xmake的支持，这个版本中OpportunityLiu贡献了大量...">

    
    <meta name="keywords" content="xmake,lua,C/C++,版本更新,Cuda,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2019/06/17/xmake-update-v2.2.7/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>xmake v2.2.7 发布, 改进Cuda项目构建</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2019-06-17
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/cn/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/cn/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#C%2FC%2B%2B" title="Tag: C/C++" rel="tag">C/C++</a-->
        <a href="/cn/tag/#C/C++" title="Tag: C/C++" rel="tag">C/C++</a>&nbsp;
    
        <!--a href="/tag/#%E7%89%88%E6%9C%AC%E6%9B%B4%E6%96%B0" title="Tag: 版本更新" rel="tag">版本更新</a-->
        <a href="/cn/tag/#版本更新" title="Tag: 版本更新" rel="tag">版本更新</a>&nbsp;
    
        <!--a href="/tag/#Cuda" title="Tag: Cuda" rel="tag">Cuda</a-->
        <a href="/cn/tag/#Cuda" title="Tag: Cuda" rel="tag">Cuda</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p>这个版本主要对Cuda项目的构建做了很多的改进，并且新增了对lex/yacc编译支持，同时也对target新增了<code class="highlighter-rouge">on_link</code>, <code class="highlighter-rouge">before_link</code>和<code class="highlighter-rouge">after_link</code>等链接阶段的定制化支持。</p>

<p>这里，我还要感谢下@<a href="https://github.com/OpportunityLiu">OpportunityLiu</a>对xmake的支持，这个版本中<a href="https://github.com/OpportunityLiu">OpportunityLiu</a>贡献了大量的代码去改进Cuda的支持。
此外，他还帮忙改进了xmake的整个单元测试框架，自更新程序，命令行tab补全以及ci脚本，使得xmake的更新迭代更加高效和稳定。</p>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">项目源码</a></li>
  <li><a href="https://xmake.io/#/zh-cn/">官方文档</a></li>
</ul>

<h2 id="新特性介绍">新特性介绍</h2>

<h3 id="cuda项目构建改进">Cuda项目构建改进</h3>

<h4 id="头文件依赖检测和增量编译">头文件依赖检测和增量编译</h4>

<p>2.2.6之前的版本，对cuda的编译支持并不是很完善，至少连头文件依赖检测也是没有提供的，因此如果cuda代码一多，每次改动都会编译所有，并不能像c/c++代码那样做到检测改动，进行增量编译。</p>

<p>而在新版本中，xmake对其进行了支持，现在已经可以很好的在不同平台下，处理依赖关系了，这对日常编译和开发效率也会有不少的提升。</p>

<h4 id="新增gencodes设置相关api">新增gencodes设置相关api</h4>

<p>之前的版本，添加gencodes配置非常的繁琐，并不简洁，可以看下之前的配置：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"cuda_console"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.cu"</span><span class="p">)</span>

    <span class="n">add_cuflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_30,code=sm_30"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_35,code=sm_35"</span><span class="p">)</span>
    <span class="n">add_cuflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_37,code=sm_37"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_50,code=sm_50"</span><span class="p">)</span>
    <span class="n">add_cuflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_52,code=sm_52"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_60,code=sm_60"</span><span class="p">)</span>
    <span class="n">add_cuflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_61,code=sm_61"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_70,code=sm_70"</span><span class="p">)</span>
    <span class="n">add_cuflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_70,code=compute_70"</span><span class="p">)</span>

    <span class="n">add_ldflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_30,code=sm_30"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_35,code=sm_35"</span><span class="p">)</span>
    <span class="n">add_ldflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_37,code=sm_37"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_50,code=sm_50"</span><span class="p">)</span>
    <span class="n">add_ldflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_52,code=sm_52"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_60,code=sm_60"</span><span class="p">)</span>
    <span class="n">add_ldflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_61,code=sm_61"</span><span class="p">,</span> <span class="s2">"-gencode arch=compute_70,code=sm_70"</span><span class="p">)</span>
    <span class="n">add_ldflags</span><span class="p">(</span><span class="s2">"-gencode arch=compute_70,code=compute_70"</span><span class="p">)</span>
</code></pre>
</div>

<p>因此为了精简xmake.lua的配置，针对cuda项目增加的<code class="highlighter-rouge">add_cugencodes</code>api来简化配置，改进后如下：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"cuda_console"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.cu"</span><span class="p">)</span>

    <span class="c1">-- generate SASS code for each SM architecture</span>
    <span class="n">add_cugencodes</span><span class="p">(</span><span class="s2">"sm_30"</span><span class="p">,</span> <span class="s2">"sm_35"</span><span class="p">,</span> <span class="s2">"sm_37"</span><span class="p">,</span> <span class="s2">"sm_50"</span><span class="p">,</span> <span class="s2">"sm_52"</span><span class="p">,</span> <span class="s2">"sm_60"</span><span class="p">,</span> <span class="s2">"sm_61"</span><span class="p">,</span> <span class="s2">"sm_70"</span><span class="p">)</span>

    <span class="c1">-- generate PTX code from the highest SM architecture to guarantee forward-compatibility</span>
    <span class="n">add_cugencodes</span><span class="p">(</span><span class="s2">"compute_70"</span><span class="p">)</span>
</code></pre>
</div>

<p>另外当配置成<code class="highlighter-rouge">add_cugencodes("native")</code>的时候，xmake会自动探测当前设备支持的gencodes，自动添加进来，会更加的方便高效。</p>

<p>这个，也要感谢下<a href="https://github.com/OpportunityLiu">OpportunityLiu</a>提供的探测代码以及对<code class="highlighter-rouge">add_cugencodes</code>的实现。</p>

<h4 id="device-link设备链接支持">device-link设备链接支持</h4>

<p>新版本中，xmake基本上重构了整个cuda的构建过程，将cuda相关构建抽离到独立的cuda构建rule中去维护，并且默认采用了device-link的链接方式。</p>

<p>关于device-link的描述和好处，可以参考相关官方介绍：https://devblogs.nvidia.com/separate-compilation-linking-cuda-device-code/</p>

<p>我们在编译包含跨编译单元的 <code class="highlighter-rouge">__global__</code> 或 <code class="highlighter-rouge">__device__</code>函数的调用的时候也是需要devlink的，因此在xmake中，目前默认就是开启了devlink。</p>

<p>对于用户来讲，并不需要对xmake.lua做任何改动，当然如果用户想要手动禁用devlink，也是可以的：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.cu"</span><span class="p">)</span>
    <span class="n">add_values</span><span class="p">(</span><span class="s2">"cuda.devlink"</span><span class="p">,</span> <span class="kc">false</span><span class="p">)</span> <span class="c1">-- 显式禁用默认的device-link行为</span>
</code></pre>
</div>

<h4 id="支持用clang编译cuda项目">支持用clang编译cuda项目</h4>

<p>clang目前也支持对*.cu文件的编译，不过不同版本的clang支持的cuda版本是有一定限制的，clang7只能支持cuda7-9.2，8支持到10，要支持10.1得需要clang9。</p>

<p>而xmake除了支持调用nvcc来编译cuda项目，也可以直接切到clang来编译，例如：</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>xmake f --cu=clang
xmake
</code></pre>
</div>

<p>不过关于devlink，似乎还是需要依赖nvcc，clang并不支持。</p>

<h4 id="可配置切换nvcc使用的c编译器">可配置切换nvcc使用的c++编译器</h4>

<p>xmake新增了<code class="highlighter-rouge">--cu-ccbin=</code>参数可以配置切换，nvcc默认使用的c++编译器和链接器，用法如下：</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>xmake f --cu-ccbin=clang++
xmake
</code></pre>
</div>

<p>即可让nvcc在编译cuda代码的时候，内部调用clang++编译器。</p>

<h3 id="定制化链接过程">定制化链接过程</h3>

<p>在新版本中，我们加入了跟link链接阶段相关的定制化处理，用户可以通过在target/rule中实现<code class="highlighter-rouge">on_link</code>, <code class="highlighter-rouge">before_link</code>和<code class="highlighter-rouge">after_link</code>来扩展定制自己的链接过程。</p>

<p>比如，我们想在正常c/c++代码的链接阶段前，预处理一些其他的事情，比如对*.o文件做些处理什么的，那么就可以在before_link阶段写点自己的lua脚本就行了：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">before_link</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span> 
        <span class="nb">print</span><span class="p">(</span><span class="s2">"process objects"</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span><span class="n">objectfiles</span><span class="p">())</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>或者我们想改写内置的链接过程，可以用<code class="highlighter-rouge">on_link</code>:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">on_link</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span> 
        <span class="nb">print</span><span class="p">(</span><span class="s2">"link objects"</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span><span class="n">objectfiles</span><span class="p">())</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>还有<code class="highlighter-rouge">after_link</code>则是在链接完成之后，做一些定制化任务。</p>

<h3 id="lexyacc编译支持">Lex/Yacc编译支持</h3>

<p>当前xmake已经可以原生支持lex/flex, yacc/bison等对<em>.l/</em>.y文件的编译处理，来快速开发一些跟编译器相关的项目。</p>

<p>我们只需要添加lex,yacc两个规则到target中，使其可以正常处理<em>.l/</em>.y文件，当然<em>.ll/</em>.yy也是支持的。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"calc"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"lex"</span><span class="p">,</span> <span class="s2">"yacc"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.l"</span><span class="p">,</span> <span class="s2">"src/*.y"</span><span class="p">)</span>
</code></pre>
</div>

<p>这里有个例子代码，可供参考：<a href="https://github.com/xmake-io/xmake/tree/dev/tests/projects/lex_yacc">lex_yacc_example</a></p>

<h3 id="运行环境设置改进">运行环境设置改进</h3>

<h4 id="设置运行目录">设置运行目录</h4>

<p>我们可以通过<code class="highlighter-rouge">set_rundir</code>接口用于设置默认运行target程序的当前运行目录，如果不设置，默认情况下，target是在可执行文件所在目录加载运行。</p>

<p>如果用户想要修改加载目录，一种是通过<code class="highlighter-rouge">on_run()</code>的方式自定义运行逻辑，里面去做切换，但仅仅为了切个目录就这么做，太过繁琐。</p>

<p>因此可以通过这个接口快速的对默认执行的目录环境做设置切换。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">set_rundir</span><span class="p">(</span><span class="s2">"$(projectdir)/xxx"</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="添加运行环境变量">添加运行环境变量</h4>

<p>另外一个新接口<code class="highlighter-rouge">add_runenvs</code>可用于添加设置默认运行target程序的环境变量。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_runenvs</span><span class="p">(</span><span class="s2">"PATH"</span><span class="p">,</span> <span class="s2">"/tmp/bin"</span><span class="p">,</span> <span class="s2">"xxx/bin"</span><span class="p">)</span>
    <span class="n">add_runenvs</span><span class="p">(</span><span class="s2">"NAME"</span><span class="p">,</span> <span class="s2">"value"</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="命令行tab补全支持">命令行tab补全支持</h3>

<p>为了改善用户体验，新版本中对命令行下xmake命令参数tab补全也做了支持，用户可以很方便快速的tab出xmake的所有命令参数。</p>

<p>当前支持zsh/bash/sh以及powershell。</p>

<h3 id="更加方便的自更新命令">更加方便的自更新命令</h3>

<p>之前的版本，xmake已经提供了方便的自更新命令<code class="highlighter-rouge">xmake update</code>来更新xmake自身版本，甚至是更新指定分支版本，例如：<code class="highlighter-rouge">xmake update dev/master</code></p>

<p>但是，还有些不足的地方：</p>

<ol>
  <li>每次更新都需要重新编译core，所以更新很慢，然而很多情况下，新版本仅仅只有脚本变动，core并不会变</li>
  <li>更新指定dev/master分支，在windows上实现的并不完美，有点滞后，并不能即时同步到线上dev/master版本。</li>
</ol>

<p>因此，这块<a href="https://github.com/OpportunityLiu">OpportunityLiu</a>帮忙做了很多的改进工作：</p>

<ol>
  <li>提供<code class="highlighter-rouge">xmake update -s/--scriptonly</code>参数，仅仅更新lua脚本，不去额外编译core，实现快速的迭代更新</li>
  <li>改进ci脚本，在windows上实现ci自动化构建，<code class="highlighter-rouge">xmake update dev</code>自动拉取ci上预构建好的安装包下载更新</li>
  <li>可以指定从其他github repo上更新xmake，方便贡献者更新自己的fork版本，也方便用户切换镜像repo，<code class="highlighter-rouge">xmake update gitee:tboox/xmake</code></li>
</ol>

<h2 id="更新内容">更新内容</h2>

<h3 id="新特性">新特性</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/440">#440</a>: 为target/run添加<code class="highlighter-rouge">set_rundir()</code>和<code class="highlighter-rouge">add_runenvs()</code>接口设置</li>
  <li><a href="https://github.com/xmake-io/xmake/pull/443">#443</a>: 添加命令行tab自动完成支持</li>
  <li>为rule/target添加<code class="highlighter-rouge">on_link</code>,<code class="highlighter-rouge">before_link</code>和<code class="highlighter-rouge">after_link</code>阶段自定义脚本支持</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/190">#190</a>: 添加<code class="highlighter-rouge">add_rules("lex", "yacc")</code>规则去支持lex/yacc项目</li>
</ul>

<h3 id="改进">改进</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/pull/430">#430</a>: 添加<code class="highlighter-rouge">add_cucodegens()</code>api为cuda改进设置codegen</li>
  <li><a href="https://github.com/xmake-io/xmake/pull/432">#432</a>: 针对cuda编译支持依赖分析检测</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/437">#437</a>: 支持指定更新源，<code class="highlighter-rouge">xmake update github:xmake-io/xmake#dev</code></li>
  <li><a href="https://github.com/xmake-io/xmake/pull/438">#438</a>: 支持仅更新脚本，<code class="highlighter-rouge">xmake update --scriptonly dev</code></li>
  <li><a href="https://github.com/xmake-io/xmake/issues/433">#433</a>: 改进cuda构建支持device-link设备代码链接</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/442">#442</a>: 改进tests测试框架</li>
</ul>


        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="english">English</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/2019/06/17/xmake-update-v2.2.7/">xmake v2.2.7 released, Improve to build Cuda project
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        
            </ul>
        

        
        
            
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">相关文章</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/17/xmake-update-v2.6.2/">xmake v2.6.2 发布，新增 Linux 内核驱动模块构建支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 发布，使用 Lua5.4 运行时，Rust 和 C++ 混合编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 发布，改进 C++20 模块，并支持 Nim, Keil MDK 和 Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 发布，新增 Pascal/Swig 程序和 Lua53 运行时支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2019/05/29/xmake-vs-cmake/">xmake vs cmake对比分析</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>下一篇</strong> <a href="/cn/2019/08/09/xmake-upload-package/">制作和上传C/C++包到xmake的官方仓库</a></p>
        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
